package ru.ifmo.trafficspy.tests;

import static org.junit.Assert.*;

import org.junit.Test;

import ru.ifmo.trafficspy.analyzer.hmm.HiddenMarkovModel;


public class HiddenMarkovModelTest {
	
	@Test
	public void test1() {
		HiddenMarkovModel hmm = new HiddenMarkovModel(2, 2);
		hmm.a[0][1] = 1;
		hmm.a[1][0] = 1;
		hmm.p0 = new double[] {1, 0};
		hmm.b[0][1] = 1;
		hmm.b[1][0] = 0.25;
		hmm.b[1][1] = 0.75;
		
		assertTrue(hmm.probabilityOfSequence(new int[] {0, 1, 1, 0, 1}) == 0);
		assertTrue(hmm.probabilityOfSequence(new int[] {1, 0, 1, 1}) == 0.25 * 0.75);
		
	}
	
}
